<template>
  <div id="app">


    <button @click="getStudent">获取学生 </button>
    <button @click="getCar">获取车 </button>
  </div>
</template>

<script>

import axios from  'axios';

export default {
  name: 'App',

  methods:{

    getStudent(){

      axios.get("http://localhost:8080/api/students").then(

          response=>{
            console.log("请求成功",response.data)
          },
          error => {
            console.log("失败",error.message)
          }
      )
    },
    getCar(){

      axios.get("http://localhost:8080/foo/cars").then(

          response=>{
            console.log("请求成功",response.data)
          },
          error => {
            console.log("失败",error.message)
          }
      )
    }
  }
}
</script>
